package com.bibrApp.difu.api;

import com.bibrApp.difu.Config;
import com.bibrApp.difu.Response.NoticeDetailResBody;
import com.bibrApp.difu.base.BaseReponse;
import com.bibrApp.difu.base.NewBaseReponse;
import com.bibrApp.difu.proto2javabean.UtxoBean;
import com.bibrApp.difu.proto2javabean.WalletAssetBean;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.Query;

/**
 * @author di
 * @date 2020/2/27
 */
public interface DfApi {

    //获取验证码
    @POST(Config.GET_GISTER_CODE_URL)
    Observable<NewBaseReponse<Object>> getVerifyCode(@Body Map<String, String> bodyMap);

    //注册
    @POST(Config.REGISTER_URL)
    Observable<NewBaseReponse<Object>> register(@Body Map<String, String> bodyMap);

    //登录
    @POST(Config.LOGIN_URL)
    Observable<NewBaseReponse<Object>> login(@Body Map<String, String> bodyMap);

    //设置或修改资金安全码
    @POST(Config.FUND_SECURITY_CODE_URL)
    Observable<NewBaseReponse<Object>> setFundSecurityCode(@Body Map<String, String> bodyMap);

    //修改登录密码
    @POST(Config.RESET_PWD_URL)
    Observable<NewBaseReponse<Object>> resetPwd(@Body Map<String, String> bodyMap);

    //普通实名认证
    @POST(Config.ORDINARY_CERTIFICATE_URL)
    Observable<NewBaseReponse<Object>> ordinaryCert(@Body Map<String, String> bodyMap);

    //高级实名认证
    @Multipart
    @POST(Config.HIGH_CERTIFICATE_URL)
    Observable<NewBaseReponse<Object>> highCert(@Part List<MultipartBody.Part> bodyMap);

    //新增支付方式
    @POST(Config.ADD_PAY_SETTING_URL)
    Observable<NewBaseReponse<Object>> addPaySetting(@Body Map<String, String> bodyMap);

    //查看所以可用支付方式
    @POST(Config.SEARCH_ALL_PAY_SETTING_URL)
    Observable<NewBaseReponse<Object>> queryAllPaySetting();

    //查看用户登录日志
    @POST(Config.LOGIN_LOG_URL)
    Observable<NewBaseReponse<Object>> queryLoginLog(@Body Map<String, String> bodyMap);

    //更新安全策略
    @POST(Config.UPDATE_STRATEGY_URL)
    Observable<NewBaseReponse<Object>> updateStrategy(@Body Map<String, String> bodyMap);

    //banner
    @POST(Config.HOME_BANNEAR_URL)
    Observable<NewBaseReponse<Object>> getBanner(@Body RequestBody body);

    //首页公告
    @POST(Config.HOME_NOTICE_URL)
    Observable<NewBaseReponse<Object>> getArticlesNoticeList(
            @Body RequestBody body);

    //公告详情
    @POST(Config.HOME_NOTICE_URL)
    Observable<NoticeDetailResBody> getNoticeDetail(
            @Body RequestBody body);

    //公告中心
    @POST(Config.HOME_NOTICE_URL)
    Observable<NewBaseReponse<Object>> getNoticeCenter(
            @Body RequestBody body);

    //退出登录
    @POST(Config.LOGIN_OUT_URL)
    Observable<NewBaseReponse<Object>> loginout(
            @Body Map<String, String> bodyMap
    );


    //借贷列表
    @POST(Config.PAWN_LIST)
    Observable<NewBaseReponse<Object>> getPawnList(
            @Body Map<String, String> bodyMap
    );

    //借贷列表
    @POST(Config.BARN_RECORD)
    Observable<NewBaseReponse<Object>> getBarnRecord(
            @Body Map<String, String> bodyMap
    );

    //借贷列表
    @POST(Config.WITHDRAWAL_LIST)
    Observable<NewBaseReponse<Object>> getWathdrawal(
            @Body Map<String, String> bodyMap
    );

    //借贷列表
    @POST(Config.ORDER_LIST)
    Observable<NewBaseReponse<Object>> getOrderList(
            @Body Map<String, String> bodyMap
    );

    //当前订单
    @POST(Config.CURRENT_ORDER)
    Observable<NewBaseReponse<Object>> getCurrentList(
            @Body Map<String, String> bodyMap
    );

    //历史订单
    @POST(Config.TRADE_LIST)
    Observable<NewBaseReponse<Object>> getTradeList(
            @Body Map<String, String> bodyMap
    );

    //订单详情
    @POST(Config.TRADE_DETAIL)
    Observable<NewBaseReponse<Object>> getTradeDetail(
            @Body Map<String, String> bodyMap
    );

    //订单详情,返回的数据更详细
    @POST(Config.AD_DETAIL)
    Observable<NewBaseReponse<Object>> getMoreTradeDetail(
            @Body Map<String, String> bodyMap
    );

    //历史订单
    @POST(Config.GET_ASSET_LIST)
    Observable<NewBaseReponse<Object>> getAssetList(
            @Body Map<String, String> bodyMap
    );

    //当前发布
    @POST(Config.TRADE_MINE)
    Observable<NewBaseReponse<Object>> getTradeMine(
            @Body Map<String, String> bodyMap
    );

    //发布借入单
    @POST(Config.PUBLISH_JIE_RU)
    Observable<NewBaseReponse<Object>> publishJieRu(
            @Body Map<String, String> bodyMap
    );

    //获取抵押币实时价格
    @GET(Config.GET_B_NEW_PRICE)
    Observable<NewBaseReponse<Object>> getBNewPrice(
            @Query("coinEunit") String coinEunit
    );

    //获取法币币种信息
    @GET(Config.GET_B_INFO)
    Observable<NewBaseReponse<Object>> getBInfo();

    //获取抵押币币种信息
    @GET(Config.GET_TRADE_PAWN_INFO)
    Observable<NewBaseReponse<Object>> getTradePawnInfo();

    //广告借出
    @POST(Config.JIE_CHU_URL)
    Observable<NewBaseReponse<Object>> jieChu(
            @Body Map<String, String> bodyMap
    );

    //账户绑定
    @POST(Config.BIND_ACCOUNT_URL)
    Observable<BaseReponse> bindAccount(
            @Body Map<String, String> bodyMap);

    //bind账号检测
    @POST(Config.BIND_ACCOUNT_CHECK_URL)
    Observable<BaseReponse> checkAccountOfBind(
            @Body Map<String, String> bodyMap
    );

    //查询总资产，有钱表示有保证金
    @POST(Config.GET_ALL_ASSETS_URL)
    Observable<NewBaseReponse<Object>> queryAllAssets();

    //查询单币资产
    @POST(Config.GET_SINGLE_CION_ASSETS_URL)
    Observable<NewBaseReponse<Object>> querySingleCionAssets(
            @Body Map<String , String> bodyMap
    );

    //查询提币地址
    @POST(Config.GET_OUT_ADDR)
    Observable<NewBaseReponse<Object>> getOutAddr(
            @Body Map<String , String> bodyMap
    );

    //提币
    @POST(Config.GET_APPLY_DRAWCOIN)
    Observable<NewBaseReponse<Object>> applyDrawCoin(
            @Body Map<String , String> bodyMap
    );

    //获取账户信息
    @POST(Config.GET_ACCOUNT_INFO_URL)
    Observable<NewBaseReponse<Object>> getAccountInfo(
            @Body RequestBody body);

    //新增提币地址
    @POST(Config.ADD_CARRY_B_ADDRESS)
    Observable<NewBaseReponse<Object>> addAddress(
            @Body Map<String , String> bodyMap);

    //获取钱包btc金额
    @GET("{coinType}/xpub/{key}")
    Observable<WalletAssetBean> getBtcBlance(
            @Path("coinType") String type,
            @Path ("key") String publicKey,
            @Query("details") String detail,
            @Query("tokens") String tokens,
            @Query("t") String time
    );
    //获取钱包eth金额
    @GET("{coinType}/address/{key}")
    Observable<WalletAssetBean> getEthBlance(
            @Path("coinType") String type,
            @Path ("key") String address,
            @Query("page") int page,
            @Query("pageSize") int pageSize,
            @Query("details") String detail

    );
    //获取钱包btc金额
    @GET(Config.GET_BTC_RATE+"{type}/cny")
    Observable<String> getRate(
            @Path ("type") String typeCoin,
            @Query("t") String time
    );
    //获取钱包btc金额
    @GET("{coinType}/utxo/{key}")
    Observable<List<UtxoBean>> getBtcUtxo(
            @Path ("coinType") String coinType,
            @Path ("key") String publicKey
    );

    //广播交易
    @GET("{coinType}/sendtx/{key}")
    Observable<String> broadcastTx(
            @Path ("coinType") String coinType,
            @Path ("key") String publicKey
    );

    //充值获取地址和金额
    @POST(Config.GET_RECHARGE_ADDRESS)
    Observable<NewBaseReponse<Object>> getRechargeAddress(
            @Body Map<String , String> bodyMap);

    //撤销
    @POST(Config.REVOKE_URL)
    Observable<NewBaseReponse<Object>> revoke(
            @Body Map<String , String> bodyMap);
    //获取补仓信息
    @POST(Config.GET_COVER_SHORT_URL)
    Observable<NewBaseReponse<Object>> getCoverShort(
            @Body Map<String , String> bodyMap);

    //获取还款地址
    @POST(Config.GET_REPAY_URL)
    Observable<NewBaseReponse<Object>> getRePayInfo(
            @Body Map<String , String> bodyMap);

    //获取签名数据
    @POST(Config.GET_SIGN_DATA_URL)
    Observable<NewBaseReponse<Object>> getSignData(
            @Body Map<String , String> bodyMap);

    //根据hash获取签名数据
    @POST(Config.GET_SIGN_DATA_BY_HASH_URL)
    Observable<NewBaseReponse<Object>> getSignDataByHash(
            @Body Map<String , String> bodyMap);
}